import { newRecordOptions } from './js/myCharts'

export default {
	name: 'check',
	data() {
		return {
			imgList: [{
				id: 0,
				icon: require('./img/search.png'),
				iconActive: require('./img/search-active.png')
			}, {
				id: 2,
				icon: require('./img/statistics.png'),
				iconActive: require('./img/statistics-active.png')
			}],
			navList: [{
				id: 0,
				name: '资产类型'
			}, {
				id: 1,
				name: '资产类别'
			}, {
				id: 2,
				name: '资产状态'
			}],
			hoverIndex: -1,
			//当前类型索引
			currentNav: 0,
			currentTable: '',
			//资产类型
			assetType: {
				//硬件资产
				hardwareAssets: [{
					name: "MD-NT-001",
					id: "1"
				}, {
					name: "MD-MO-003",
					id: "2"
				}, {
					name: "MD-CA-002",
					id: "3"
				}, {
					name: "MD-NT-006",
					id: "4"
				}, {
					name: "MD-NT-011",
					id: "5"
				}, {
					name: "MD-NT-019",
					id: "6"
				}],
				//软件资产
				softwareAssets: [{
					name: "信息化管理",
					id: "1"
				}, {
					name: "查询一体化管理",
					id: "2"
				}],
				//数据资产
				dataAssets: [{
					name: "DT-PQ-001",
					id: "1"
				}],
			},
			//资产类别
			assetClass: {
				//笔记本
				notebook: [{
					name: "MD-NT-001",
					id: "1"
				}, {
					name: "MD-NT-006",
					id: "2"
				}, {
					name: "MD-NT-019",
					id: "3"
				}],
				//手机
				mobilePhone: [{
					name: "MD-MO-003",
					id: "1"
				}, {
					name: "MD-CA-002",
					id: "2"
				}],
				//汽车
				car: [{
					name: "DT-PQ-001"
				}],
			},
			//资产状态
			assetStatus: {
				//在库
				inLibrary: [{
					name: "MD-NT-001",
					id: "1",
					type: "硬件资产",
				}, {
					name: "MD-NT-006",
					id: "2",
					type: "硬件资产",
				}, {
					name: "MD-NT-019",
					id: "3",
					type: "硬件资产",
				}],
				//已领用
				alreadyUsed: [{
					name: "MD-MO-003",
					id: "1",
					type: "硬件资产",
				}, {
					name: "信息化管理",
					id: "2",
					type: "软件资产",
				}, {
					name: "查询一体化管理",
					id: "3",
					type: "软件资产",
				}],
				//外借
				borrowFrom: [{
					name: "DT-PQ-001",
					id: "1",
					type: "硬件资产",
				}],
			},
			multipleSelection: [],
			drawer: false, // 统计抽屉,
		}
	},
	computed: {
		newRecordOptions() {
			return newRecordOptions
		},
		categoryOptions() {
			return categoryOptions
		}
	},
	mounted() {},
	methods: {
		/**
		 * 鼠标移出
		 * @param index
		 */
		mouseLeave: function(index) {
			this.hoverIndex = index;
		},
		/**
		 * 鼠标移入
		 * @param index
		 */
		mouseEnter: function(index) {
			this.hoverIndex = index;
		},
		/*点击图标弹出相应的弹框*/
		iconClick(id) {
			if (id === 2) {
				this.drawer = true
				this.$nextTick(() => {
					this.initCharts()
				})
			}
		},
		/*调用echart*/
		initCharts() {
			// 每日新增资产
			let newRecordChart = this.$echarts.init(document.getElementById('newRecord'))
			newRecordChart.setOption(this.newRecordOptions)
		},

		//切换资产类型
		switchNav(index) {
			this.currentNav = index;
		},
	}
}